package com.itheima.wemedia.feign;

import com.itheima.common.vo.ResultVo;
import com.itheima.wemedia.pojo.WmMaterial;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 为了远程调用自媒体微服务，保存素材到素材库
 */
@FeignClient(name = "leadnews-wemedia",contextId = "weMaterialFeign")
public interface WmMaterialFeign {
    /**
     * 添加素材
     * @param wmMaterial
     * @return
     */
    @PostMapping("/api/wmMaterial/add")
    ResultVo add(@RequestBody WmMaterial wmMaterial);

    /**
     * 删除素材
     * @param id
     * @return
     */
    @GetMapping("/api/wmMaterial/delete/{id}/{userId}")
    ResultVo delete(@PathVariable Long id,@PathVariable Long userId);

    /**
     * 查询素材
     * @param id
     * @return
     */
    @GetMapping("/api/wmMaterial/select/{id}")
    ResultVo<WmMaterial> selectById(@PathVariable Long id);
}
